package com.dhcc.jparw.config;

import org.springframework.jdbc.datasource.lookup.AbstractRoutingDataSource;

import com.dhcc.jparw.config.handler.HandlerDataSource;

public class DynamicDataSource extends AbstractRoutingDataSource {

  @Override
  protected Object determineCurrentLookupKey() {
    // 可以做一个简单的负载均衡策略
    String lookupKey = HandlerDataSource.getDataSource();
    System.out.println("------------lookupKey---------" + lookupKey);
    return lookupKey;
  }
}
